﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using DAL;

namespace BLL
{
    /// <summary>
    /// BLL用户登录
    /// </summary>
    public class LoginManager
    {
        /// <summary>
        /// 用户登录BLL
        /// </summary>
        /// <param name="userName">用户名</param>
        /// <param name="passWord">密码</param>
        /// <returns></returns>
        public Model.UserInfo UserLogin(string userName,string passWord)
        {
            //创建一个user
            DAL.UserDAO uDao=new UserDAO();
            //通过ui中填写的内容 返回来相应的数据
            Model.UserInfo user = uDao.SelectUser(userName, passWord);
            if (user!=null)
            {
                DAL.ScoreDAO sDao=new ScoreDAO();
                sDao.UpdateScore(userName,10);
                return user;
            }
            else
            {
                throw new Exception("登录失败");
            }
        }
    }
}
